import moment from "moment/moment";


export function enterSubmit(e) {
  e.preventDefault();
}

export function filterFollowType(type) {
  switch (type) {
    case '1':
      return '【认领维系】';
    case '2':
      return '【实名完成】';
    case '3':
      return '【添加报账】';
    case '4':
      return '【交易失败】';
    case '5':
      return '【添加跟进】';
    case '6':
      return '【打标激活】';
    case '7':
      return '【回退实名】';
    case '8':
      return '【回调处理】';
    case '9':
      return '【订单作废】';
    case '10':
      return '【交易成功】';
    default:
      return ''
  }
}


export function orderType(type) {
  switch (type) {
    case '1':
      return '网站支付单';
    case '2':
      return '网站未付单';
    case '3':
      return '网站秒杀单';
    case '4':
      return '网站预存单';
    case '5':
      return '抖店单';
    case '6':
      return '数码大超市';
  }
}

export function getClassName(type) {
  switch (type) {
    case '1':
      return '移动';
    case '2':
      return '联通';
    case '3':
      return '电信';
    case '4':
      return '虚商';
    default:
      return "未知";
  }
}

export function orderState(state) {
  switch (state) {
    case '1':
      return '代付款';
    case '2':
      return '未处理';
    case '3':
      return '处理中';
    case '4':
      return '待竣工';
    case '5':
      return '已实名';
    case '6':
      return '已完成';
    case '7':
      return '已弃单';
    case '8':
      return '已取消';
    case '9':
      return '已超时';
    case '100':
      return '已废弃';
  }

}

export function getStateClass(state) {

  switch (state) {
    case '1':
      return 'daiFuKuan';
    case '2':
      return 'weiChuLi';
    case '3':
      return 'chuLiZhong';
    case '4':
      return 'daiJunGong';
    case '5':
      return 'yiShiMing';
    case '6':
      return 'yiWanCheng';
    case '7':
      return 'yiQiDan';
    case '8':
      return 'yiQuXiao';
    case '9':
      return 'yiChaoShi';
    case '100':
      return 'yiFeiQi';
  }
}

export function getTagClass(state, labelName) {
  if (labelName && labelName.includes('缺失证据链')) {
    return '#FF0000';
  }

  switch (state) {
    case '1':
      return '#4169E1';
    case '2':
      return '#0000FF';
    case '3':
      return '#00CD00';
    case '4':
      return '#FF6347';
    case '5':
      return '#FF7F00';
    case '6':
      return '#FF0000';
    case '7':
      return '#696969';
    case '8':
      return '#4F4F4F';
    case '9':
      return '#1C1C1C';
    case '100':
      return '#B5B5B5';
  }
}

export function getKsTagClass(state) {
  switch (state) {
    case 1:
      return '#FF0000';
    case 2:
      return '#f3c727';
    case 3:
      return '#00a6ff';
    case 4:
      return '#00CD00';
    case 6:
      return '';
    case 5:
      return '';
  }
}

export function formatTime(row, column, cellValue) {

  return moment(row * 1000).format('MM-DD HH:mm:ss');
}

export function formatTime2(row, column, cellValue) {

  return moment(row * 1000).format('MM-DD HH:mm');
}

export function formatTimeTitle(row, column, cellValue) {

  return moment(row * 1000).format('YYYY-MM-DD HH:mm:ss');
}


export function formatTimeTitleExcel(row, column, cellValue) {

  return moment().format('YYYYMMDDHHmmss');
}

export function hasRole(roleNames) {
  if (!this.$store.state.user.roles) return false;
  const requiredRoles = roleNames.split(',').map(role => role.trim());
  return requiredRoles.some(role => this.$store.state.user.roles.includes(role));
}
